package cn.tedu.mall.search.test.tree;

import lombok.extern.slf4j.Slf4j;

public class ErChaShu {
    public static void main(String[] args) {
        Node root = new Node(5);
        root.left = new Node(3);
        root.left.left = new Node(9);
        root.left.right = new Node(8);
        root.right = new Node(3);
        root.right.left = new Node(8);
        root.right.right = new Node(9);

        f(root);
    }

    private static void f(Node root) {
        if (root == null){
            return;
        }
        System.out.println(root.value);
        f(root.left);
        f(root.right);
    }

    static class Node {
        int value;
        Node left;
        Node right;

        Node(int value) {
            this.value = value;
        }
    }
}
